<template>
  <div id="app">
    <update></update>
    <transition :name="transitionName">
      <router-view class="main"></router-view>
    </transition>
  </div>
</template>

<script>
import { mapGetters } from 'vuex';
import { NavigationBarSDK } from '@/cordova';
import update from '@/page/update/';

export default {
  name: 'app',
  data() {
    return {
      transitionName: 'slide-left',
    };
  },
  components: {
    update,
  },
  watch: {
    $route(to, from) {
      if (this.$router.isBack || from.path === '/iframe/urlPath') {
        this.transitionName = 'slide-right';
      } else {
        this.transitionName = 'slide-left';
      }
      this.$router.isBack = false;
    },
  },
  created() {

  },
  methods: {},
  computed: {},
};
</script>
<style lang="scss">
body,
html {
  height: 100%;
}
.slide-right-enter-active,
.slide-right-leave-active,
.slide-left-enter-active,
.slide-left-leave-active {
  will-change: transform;
  transition: all 500ms;
}

.slide-right-enter {
  transform: translate3d(-100%, 0, 0);
}
.slide-right-leave-active {
  transform: translate3d(100%, 0, 0);
}
.slide-left-enter {
  transform: translate3d(100%, 0, 0);
}
.slide-left-leave-active {
  transform: translate3d(-100%, 0, 0);
}

.main {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #efeff4;
  overflow-y: auto;
}
#app {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
</style>